#ifndef _CIRCULAR_QUEUE_H
#define _CIRCULAR_QUEUE_H

#include "stdint.h"
#include "string.h"
#include "./usart/usart.h"

#define QUEUE_MAX_SIZE		64

typedef enum { false, true } bool;

typedef struct circularqueue
{
	uint8_t data[QUEUE_MAX_SIZE];
	uint16_t head;
	uint16_t tail;
	uint16_t length;
	bool inited;
}circularqueue_t;

void CircularQueue_Init(circularqueue_t* pcq);
bool CircularQueue_isEmpty(circularqueue_t* pcq);
bool CircularQueue_isFull(circularqueue_t* pcq);
bool CircularQueue_Push(circularqueue_t* pcq, uint8_t element);
uint16_t CircularQueue_Size(circularqueue_t* pcq);
uint8_t CircularQueue_Front(circularqueue_t* pcq);
bool CircularQueue_Pop(circularqueue_t* pcq, uint8_t *pdata);
void CircularQueue_Print(circularqueue_t* pcq);

#endif
